#include <stdio.h>
#include <math.h>
class vector3D     ///point or vector
{
public:
    double x, y, z;
public:
    vector3D(double a = 0, double b = 0, double c = 0) : x(a), y(b), z(c) {}
    vector3D& operator+=(vector3D a) {x+=a.x,y+=a.y,z+=a.z;return *this;}
    vector3D operator+(vector3D a) {a.x+=x,a.y+=y,a.z+=z;return a;}
    vector3D& operator-=(vector3D a) {x-=a.x,y-=a.y,z-=a.z;return *this;}
    vector3D operator-(vector3D a) {a.x=x-a.x,a.y=y-a.y,a.z=z-a.z;return a;}
    vector3D& operator*=(double k) {x*=k,y*=k,z*=k;return *this;}
    vector3D operator*(double k) {return vector3D(x*k,y*k,z*k);}
    double operator*(vector3D a) {return x*a.x+y*a.y+z*a.z;}        ///dot product
    vector3D operator|(vector3D a) {return vector3D(y*a.z-z*a.y,z*a.x-x*a.z,x*a.y-y*a.x);}  ///cross product
    double vlen() {return sqrt(x*x+y*y+z*z);}                       ///length of the vector3D
    double get_sin(vector3D a) {return ( ((*this)|a).vlen() )/( this->vlen()*a.vlen() );}
    double get_cos(vector3D a) {vector3D &b=*this;return (b*b+a*a-(a-b)*(a-b))/((a*b)*2);}
};

class line3D    ///Vector equation,p=s+tm
{
public:
    vector3D s,m;
public:
    line3D(vector3D a,vector3D b):s(a),m(b-a) {}

};

class segment3D
{
public:
    vector3D s,t;
public:
    segment3D(vector3D a,vector3D b):s(a),t(b) {}
};

class matrix3D
{
public:
    double p[2][2];
public:
};
